//
//  CustomAnnotationView.m
//  ZhuanZuBao
//
//  Created by 戴伟 on 2020/9/10.
//  Copyright © 2020 戴伟. All rights reserved.
//

#import "CustomAnnotationView.h"
#define kCalloutWidth       200.0
#define kCalloutHeight      70.0

@implementation CustomAnnotationView

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    
    if (self.calloutView == nil)
    {
        self.calloutView = [[CustomCalloutView alloc] initWithFrame:CGRectMake(0, 0, kCalloutWidth, kCalloutHeight)];
        self.calloutView.center = CGPointMake(CGRectGetWidth(self.bounds) / 2.f + self.calloutOffset.x,
                                              10);
    }
    
    
    self.calloutView.title = self.annotation.title;
    self.calloutView.subtitle = self.annotation.subtitle;
    
    [self addSubview:self.calloutView];
    
    
    [super setSelected:selected animated:animated];
}
@end
